function show_hide_auth()
{
	var a = $("#editUser_userInfo_isAdmin");
	var b = $("#editUser_userInfo_isAdmin").attr("checked");
	var c = $("#editUser_userInfo_isAdmin").attr("value");
	if($("#editUser_userInfo_isAdmin").attr("checked") == "checked")
	{
		$("#auths-1").attr("disabled",false);
		$("#auths-2").attr("disabled",false);
		$("#auths-3").attr("disabled",false);
	}
	else
	{
		$("#auths-1").attr("checked",false);
		$("#auths-2").attr("checked",false);
		$("#auths-3").attr("checked",false);
		
		$("#auths-1").attr("disabled",true);
		$("#auths-2").attr("disabled",true);
		$("#auths-3").attr("disabled",true);
	}
		
	
}
function to_advance_search(){
	$("#fm").hide();
	$("#ad_search").show();
}
function to_easy_search(){
	$("#fm").show();
	$("#ad_search").hide();
}

function a23(){
	 	var a = as['hello'];
	 	var b = 1;
	 	var c = as;
	 	var d = as;
	 	
}

function endUpload()
{
	$.ajax({
        url: "file/endUpload.action",
        type: "POST",
        data: {"code":"end"},
        dataType: 'json',
        success: function( result ){
        	 alert(result);
         }
		});
	//this.swfu.addPostParam("id_in", a);
	//this.swfu.addPostParam("con", c.files[0]);
	
}


function morefile()
{

	$("#tr_sumbit_id").before('<td><th></th><td><input name="files" type="file"/></td></tr>');	
	$("#tr_sumbit_id").before('<tr><th></th><td><input name="files" type="file"/></td></tr>');
}


function item_stat_onChanged() {
      $("#id_item_stat").submit();
}
     
function switchFileStat(item, new_stat){
	var url = "file/ajaxSwitFileStat.action";
	var stat = $("#id_file_stat_"+ item).text();
	if (stat == '2')
		new_stat = 1;
	else
		new_stat = 2;
	
	var params = {"itemID":item,"new_stat":new_stat};
	$.ajax({
		type:'POST',
		url:url,
		data:params,
		success:callbackSuccess,
		dataType:'json'
	});

}
function callbackSuccess(data){
	var id = data['item'];
	var stat = data['new_stat'];
	var name = $("#id_file_name_"+id).text();
	if(stat == 2){		
		$("#id_file_show_"+id).html(name + "<span style='color:red'>(禁止显示)</span>");
		$("#id_swit_stat_"+id).text("显示");
		
	}else{
		$("#id_file_show_"+id).html(name);
		$("#id_swit_stat_"+id).text("禁止显示");
	}
	
	$("#id_file_stat_"+id).text(stat);
	
	
}

function showallcountry(){
	$(".s-topsearch-item").show();
}

function sendREmail(username){
	$.ajax({
		type:'POST',
		url:'user/send_email_r.action',
		data:{'username':username},
		success:sendEmailSuccess,
		dataType:'json'
	});
}

function sendEmailSuccess(data){
	var r = data['success'];
	if (r == 'true'){
		alert("发送成功，请注意接收");
	}else{
		alert("发送失败");
	}
}

function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}

//minsec created by Daem0nX (03.29.08)
function minsec(time, tempTime) {
var ztime;
if (time == "m") {
   ztime = Math.floor(tempTime/60);
   if (ztime < 10) {
    ztime = "0" + ztime; 
   }
} else if (time == "s") {
   ztime = Math.ceil(tempTime % 60);
   if (ztime < 10) {
    ztime = "0" + ztime; 
   }
} else {
   ztime = "minsec error...";
}
return ztime;
}

var timer;
var time_remain = -1;
var file_use_id;

function waitTimeout(){	
	if (time_remain >= 0){
		$("#id_x").text(time_remain);
		
		try{
			var bar = document.getElementById(file_use_id+"_bar");	
			time_remain = time_remain + 1;
			bar.style.width=time_remain+"px";
		}catch(ex){
			var c = 0;
		}
		if (time_remain >= 100){
			time_remain = 0;
		}
		
		setTimeout("waitTimeout()", 40);
	}
}

function testt(){
	time_remain = 0;
	setTimeout("waitTimeout()", 40);
}